<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Topclass_new {
    var $CI;
    var $appsetingarray;
     //传入如下初始化参数：
    //   $lib_config_array = array('congfile' => '####', 'congifarray_key' => '####',type=>'###');
    public function __construct($lib_config_array) {
        $this->CI = & get_instance();
        $this->CI->load->helper('url');
        $this->CI->load->library('top/top/TopClient');
        $this->CI->load->library('top/top/RequestCheckUtil');
        //  include "top/TopSdk.php";
        $this->CI->config->load($lib_config_array["congfile"]); //加载配置文件   
        if (isset($lib_config_array["type"])) {//设定类型
            $appsetingarray = $this->CI->config->item($lib_config_array["congifarray_key"]);
            $this->appsetingarray = $appsetingarray[$lib_config_array["type"]];
        } else {
            $this->appsetingarray = $this->CI->config->item($lib_config_array["congifarray_key"]); //作为参数传递
        }
        //  print_r($lib_config_array["congifarray_key"][$lib_config_array["type"]]);
        // Do something with $params
    }

    public function get_topobj($classname) {//获得top的初始化对象，传入类名称
        $apiurl = "top/top/request/{$classname}";
        $this->CI->load->library($apiurl);
        $c = new TopClient;
        $appsetingarray = $this->appsetingarray;
        $c->appkey = $appsetingarray["appkey"]; //"21124740"
        $c->secretKey = $appsetingarray["appsecck"]; //"d6a8581eac74eb1fc5ad73bb846b3d53"
        return $c;
    }

    public function test() {
        print_r($this->appsetingarray);
    }

}

/* End of file Someclass.php */